package week4;
import java.util.*;

public class Day4 {
    //1.添加字符
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String A = in.nextLine();
            String B = in.nextLine();
            int len = B.length() - A.length();
            int min=99999;
            int k=0;
            while(k<=len) {
                int tmp=0;
                for(int i=0;i<A.length();i++) {
                    if(A.charAt(i) != B.charAt(i+k)) tmp++;
                }
                min=Math.min(min,tmp);
                k++;
            }
            System.out.println(min);
        }
    }
}
